{% extends "control/base.html" %}
{% load i18n %}
{{form.media}}
{% load adminmedia %}
{% block extrahead %}
<script type="text/javascript">
window.__admin_media_prefix__ = "{% filter escapejs %}{% admin_media_prefix %}{% endfilter %}";
</script>

<script type="text/javascript" src="/admin/jsi18n/"></script> 

<script type="text/javascript" src="/static/django/js/core.js"></script>
<script type="text/javascript" src="/static/django/js/admin/RelatedObjectLookups.js"></script>
<script type="text/javascript" src="/static/django/js/calendar.js"></script>
<script type="text/javascript" src="/static/django/js/admin/DateTimeShortcuts.js"></script>
<link rel="stylesheet" type="text/css" href="/static/django/css/forms.css"/>
<link rel="stylesheet" type="text/css" href="/static/django/css/base.css"/>
<link rel="stylesheet" type="text/css" href="/static/django/css/widgets.css"/>
{% endblock %}
         
{%block content%}  
        <form method="GET">
             <ul>
             	<table>
             		<tr>
             			<td><h2>Nombre:	{{ eval.nombre }}</h2></td>
             			<td></td>
             			<td><h2>Motivo de la No Conformidad:		{{ eval.motivo }}</h2></td>
             		</tr>
             		<tr>
             			<td><h2>Clase de Causa:	{{ eval.clase }}</h2></td>
             			<td></td>
             			<td><h2>Causa:		{{ eval.causa }}</h2></td>
             		</tr>
                	<tr>
                		<td><h2>Fecha:		{{ eval.fecha }}</h2></td>
                	</tr>
             	</table>
             	{% if accion %}
				<table cellpadding="15px">
					<tr>
					<td><h3>Acción a tomar		</h3></td>
					<td></td>
					<td></td>
					<td><h3>Plazo		</h3></td>
					<td></td>
					<td></td>
					<td><h3>Responsable		</h3></td>
					<td></td>
					<td></td>
					<td><h3>Conformidad		</h3></td>
					<td></td>
					<td></td>
					<td><h3>Reprogramado		</h3></td>
					<td></td>
					<td></td>
					</tr>
				{% endif %}
				<br />
				<br />
				{% for item in accion %}
					<tr>
					<td>	{{ item.accion }}	</td>
					<td></td>
					<td></td>
					<td>	{{ item.plazo }}	</td>
					<td></td>
					<td></td>
					<td>	{{ item.responsable }}	</td>
					<td></td>
					<td></td>
							{% if item.conformidad == 'C' %}
								<td>	Conforme	</td>
							{% else %}
								<td>	No Conforme	</td>
							{% endif %}
					<td></td>
					<td></td>
							{% if item.reprogramado == 'S' %}
								<td>	Si	</td>
							{% else %}
								<td>	No	</td>
							{% endif %}
					{% if pedido.finalizado == 'N' or pedido.finalizado == 'M'%}
						{% if item.ec == 'N' %}
							<td><input type="button" value="Borrar" onclick="location.href='/wal/control/accion/borrar/{{item.id}}/'"/></td>
							{% if item.reprogramado == 'N' %}
								<td><input type="button" value="Reprogramar" onclick="location.href='/wal/control/accion/r/{{item.id}}/'"/></td>
								<td><input type="button" value="Conforme" onclick="location.href='/wal/control/accion/c/{{item.id}}/'"/></td>
								<td><input type="button" value="No Conforme" onclick="location.href='/wal/control/accion/n/{{item.id}}/'"/></td>
							{% endif %}
							
						{% endif %}
					{% endif %}
					</tr>
				{% endfor %}
				</table>
			 </ul>
        </form>
        <br />
				<br />
				<br />
				<br />
		{% if pedido.finalizado == 'N' or pedido.finalizado == 'M'%}
			{% if ban == 'No' %}
		        <form method="POST">
		       		<ul>
		       			<table cellpadding="10px">
		       				{% csrf_token %}
		       				<tr>
		       					{% for field in accion_forms %}
		       						<td><h3>{{ field.label }}</h3></td>
		       					{% endfor %}
		       				</tr>
		       				<tr>
			       				{% for field in accion_forms %}
					   				<td>{{ field }}</td>
								{% endfor %}
								<td><input type="submit" class="find_link" value="Guardar" /></td>
							</tr>
							<tr>
			       				{% for field in accion_forms %}
					   				<td>{{ field.errors }}</td>
								{% endfor %}
							</tr>
		       			</table>
		       		</ul>
		       	</form>
		    {% endif %}
		{% endif %}
		<input type="button" class="find_link" value="Volver al Control de Calidad" onclick="location.href='/wal/control/ver/{{control.id}}'"/>
{%endblock%}
